package com.meilai.project.mapper.business.contract;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.meilai.project.entity.business.contract.ContractAttachment;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author xchen
 * @since 2022-03-13
 */
@Mapper
public interface ContractAttachmentMapper extends BaseMapper<ContractAttachment> {

	@Update("delete from contract_attachment where contract_id = #{contract_id} ")
	int clearContractRelation(@Param("contract_id") Long contractId);

	int updateContractId(@Param("contract_id") Long contractId, @Param("ids") List<Long> ids);

	@Select("select * from contract_attachment where contract_id = #{contract_id} and type = #{type} ")
	List<ContractAttachment> listByContractId(@Param("type") Integer type, @Param("contract_id") Long contractId);
}
